// 队伍消息
class TeamMessage {
  messageForKick(payload) {
    const { teamName, teamAuthor, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `你已经被${teamAuthor}踢出(队名：${teamName})`,
      isView: false,
    };

    return item;
  }

  messageForJoin(payload) {
    const { teamName, teamMember, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${teamMember}加入了你的队伍(队名：${teamName})`,
      isView: false,
    };
    return item;
  }

  messageForDissolve(payload) {
    const { teamName, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${teamName}队伍已解散`,
      isView: false,
    };
    return item;
  }

  messageForAllocTask(payload) {
    const { taskName, teamAuthor, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${teamAuthor}发布了任务：${taskName}`,
      isView: false,
    };
    return item;
  }

  messageForApply(payload) {
    const { teamName, applyName, receiveId, teamId } = payload;
    const item = {
      type: 1,
      receiveId,
      teamId,
      teamName,
      createTime: new Date(),
      content: `${applyName}想要加入你的队伍(${teamName})`,
      isView: false,
      isPower: true,
      isHandle: false,
    };
    return item;
  }

  messageForInvite(payload) {
    const { teamName, receiveId, teamId, inviteName } = payload;
    const item = {
      type: 1,
      receiveId,
      teamId,
      teamName,
      createTime: new Date(),
      content: `${inviteName}想邀请您加入他的队伍(${teamName})`,
      isView: false,
      isInvite: true,
      isHandle: false,
    };
    return item;
  }

  messageForAgree(payload) {
    const { teamName, authorName, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${authorName}同意了你的申请加入(${teamName})`,
      isView: false,
    };
    return item;
  }

  messageForRefuse(payload) {
    const { teamName, authorName, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${authorName}拒绝了你的申请加入(${teamName})`,
      isView: false,
    };
    return item;
  }

  messageForRefuseInvite(payload) {
    const { authorName, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${authorName}拒绝了你的邀请`,
      isView: false,
    };
    return item;
  }

  messageForAcceptInvite(payload) {
    const { authorName, receiveId } = payload;
    const item = {
      type: 1,
      receiveId,
      createTime: new Date(),
      content: `${authorName}同意了你的邀请`,
      isView: false,
    };
    return item;
  }
}

// 用户消息
class UserMessage {
  messageForFocus(payload) {
    const { focusName, receiveId } = payload;
    const item = {
      type: 0,
      receiveId,
      createTime: new Date(),
      content: `${focusName}关注了你`,
      isView: false,
    };
    return item;
  }
  messageForCancelFocus(payload) {
    const { focusName, receiveId } = payload;
    const item = {
      type: 0,
      receiveId,
      createTime: new Date(),
      content: `${focusName}取消了对你的关注`,
      isView: false,
    };

    return item;
  }
}

// 任务消息
class TaskMessage {
  messageForPublishTask(payload) {
    const { teamName, authorName, receiveId, taskName } = payload;
    const item = {
      type: 2,
      receiveId,
      createTime: new Date(),
      content: `${authorName}给你分配了任务：'${taskName}'（来自队伍：${teamName}）`,
      isView: false,
    };
    return item;
  }
}

export { TeamMessage, UserMessage, TaskMessage };
